package app.texas.com.devilfishhouse.View.Fragment.home;

import java.util.List;

import app.texas.com.devilfishhouse.Base.BaseIView;
import app.texas.com.devilfishhouse.Base.BaseModel;
import app.texas.com.devilfishhouse.Base.BasePresenter;
import app.texas.com.devilfishhouse.Base.IModel;
import app.texas.com.devilfishhouse.Beans.BannerBean;
import app.texas.com.devilfishhouse.Beans.HotLineBean;

/**
 * Created by solin on 2018/7/16.
 */

public class HomePresenter extends BasePresenter {
    HomeFragmentView homeView;
    HomeModel homeModel;

    public HomePresenter(BaseIView iView) {
        super(iView);
        homeView = (HomeFragmentView) iView;
    }

    @Override
    public void oncreate() {
        super.oncreate();
    }

    @Override
    public BaseModel getIModel() {
        homeModel = new HomeModel();
        return homeModel;
    }

    /**
     * 获取轮播图数据
     */
    public void getBanner(String params) {
        homeModel.getBanner(params, new IModel.IListCallBack() {
            @Override
            public void onResult(List<BannerBean> data) {
                homeView.setBanner(data);
            }
        });

    }

    /**
     * 获取热门头条
     *
     * @param params
     */
    public void getHotline(String params) {
        homeModel.getHotLine(params, new IModel.ICallBack() {
            @Override
            public void onResult(Object data) {
                homeView.setHotLine((List<HotLineBean>) data);
            }
        });
    }

    @Override
    public void onResume() {
        super.onResume();
    }

    @Override
    public void onDestory() {
        super.onDestory();
    }
}
